<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div v-show="showSearch" class="mb-[10px]">
        <el-card shadow="hover">
          <el-form ref="queryFormRef" :model="queryParams" :inline="true">
            <el-form-item label="合同编号" prop="contractNumber">
              <el-input v-model="queryParams.contractNumber" placeholder="请输入合同编号" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="合同名称" prop="contractName">
              <el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter="handleQuery" />
            </el-form-item>
      <!--       <el-form-item label="归属项目" prop="projectId">
              <el-input v-model="queryParams.projectId" placeholder="请输入归属项目ID" clearable @keyup.enter="handleQuery" />
            </el-form-item> -->
            <el-form-item label="归属项目名称" prop="projectName">
              <el-input v-model="queryParams.projectName" placeholder="请输入归属项目名称" clearable @keyup.enter="handleQuery" />
            </el-form-item>
         <!--    <el-form-item label="签订日期" prop="signingDate">
              <el-date-picker clearable
                v-model="queryParams.signingDate"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择签订日期"
              />
            </el-form-item>
            <el-form-item label="合同性质" prop="contractNature">
              <el-input v-model="queryParams.contractNature" placeholder="请输入合同性质" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="买方联系人" prop="buyerContact">
              <el-input v-model="queryParams.buyerContact" placeholder="请输入买方联系人" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="联系电话" prop="contactPhone">
              <el-input v-model="queryParams.contactPhone" placeholder="请输入联系电话" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="邮箱" prop="email">
              <el-input v-model="queryParams.email" placeholder="请输入邮箱" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="交货时间" prop="deliveryTime">
              <el-date-picker clearable
                v-model="queryParams.deliveryTime"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择交货时间"
              />
            </el-form-item>
            <el-form-item label="交货地点" prop="deliveryLocation">
              <el-input v-model="queryParams.deliveryLocation" placeholder="请输入交货地点" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="交货条件" prop="deliveryTerms">
              <el-input v-model="queryParams.deliveryTerms" placeholder="请输入交货条件" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="保质期至" prop="warrantyExpiry">
              <el-date-picker clearable
                v-model="queryParams.warrantyExpiry"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择保质期至"
              />
            </el-form-item>
            <el-form-item label="审批人ID" prop="approverId">
              <el-input v-model="queryParams.approverId" placeholder="请输入审批人ID" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="审批人姓名" prop="approverName">
              <el-input v-model="queryParams.approverName" placeholder="请输入审批人姓名" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="拒绝原因" prop="rejectionReason">
              <el-input v-model="queryParams.rejectionReason" placeholder="请输入拒绝原因" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="审批时间" prop="approvalTime">
              <el-date-picker clearable
                v-model="queryParams.approvalTime"
                type="date"
                value-format="YYYY-MM-DD"
                placeholder="请选择审批时间1111"
              />
            </el-form-item> -->
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:contract:add']">新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:contract:edit']">修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:contract:remove']">删除</el-button>
          </el-col>
          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
      </template>

      <el-table v-loading="loading" border :data="contractList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="唯一标识" align="center" prop="id" v-if="false" />
        <el-table-column label="合同编号" align="center" prop="contractNumber" />
        <el-table-column label="合同名称" align="center" prop="contractName" />
        <el-table-column label="归属项目ID" align="center" prop="projectId" v-if="false" />
        <el-table-column label="归属项目名称" align="center" prop="projectName" />
        <el-table-column label="签署状态" align="center" prop="signingStatus" />
        <el-table-column label="签订日期" align="center" prop="signingDate" width="180">
          <template #default="scope">
            <span>{{ parseTime(scope.row.signingDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="合同性质" align="center" prop="contractNature" v-if="false" />
        <el-table-column label="买方单位名称" align="center" prop="buyerCompany" />      
        <el-table-column label="联系电话" align="center" prop="contactPhone" v-if="false" />
        <el-table-column label="邮箱" align="center" prop="email" v-if="false" />
        <el-table-column label="合同草案" align="center" prop="contractDraft" v-if="false" />
      <!--   <el-table-column label="合同附件" align="center" prop="contractAttachment" /> -->
        <el-table-column label="操作" align="center" class-name="small-padding" width="280">
          <template #default="scope">
            <div class="flex flex-nowrap gap-1">
            <el-tooltip content="查看" placement="top">
              <el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['supplier:supplier:view']"></el-button>
            </el-tooltip>
            <el-tooltip content="修改" placement="top">
              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:contract:edit']"></el-button>
            </el-tooltip>
            <el-tooltip content="删除" placement="top">
              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:contract:remove']"></el-button>
            </el-tooltip>
        <!--     <el-tooltip content="交付物" placement="top">
              <el-button link type="primary" @click="handleCoSupplies(scope.row)" v-hasPermi="['project:coSupplies:list']">交付物</el-button>
            </el-tooltip> -->
            <el-tooltip content="交付物" placement="top">
            <el-button link type="primary" @click="openSuppliesDialog(scope.row)">交付物</el-button>
            </el-tooltip>
            <el-tooltip content="付款方式" placement="top">
            <el-button link type="primary" @click="openSuppliesDialog(scope.row)">付款方式</el-button>
            </el-tooltip>
          </div>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>

      <!-- 新增：交付物列表弹窗 1111为甚没有提交记录？？ -->
     <el-dialog :visible.sync="suppliesDialogVisible" title="交付物列表">
      <template #content>
        <div class="p-4">
          <h3>{{ currentContract.contractName }} 的交付物</h3>
          <el-table :data="suppliesList" border>
            <el-table-column prop="id" label="ID" />
            <el-table-column prop="name" label="名称" />
            <el-table-column prop="description" label="描述" />
            <!-- 其他列 -->
          </el-table>
        </div>
      </template>
      <template #footer>
        <el-button @click="suppliesDialogVisible = false">关闭</el-button>
      </template>
    </el-dialog>
    <!-- 添加或修改合同管理对话框 -->
   <el-dialog :title="dialog.title" v-model="dialog.visible" width="70%" append-to-body>
  <el-form ref="contractFormRef" :model="form" :rules="rules" label-width="120px">
    <!-- 第一行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="合同编号" prop="contractNumber">
          <el-input v-model="form.contractNumber" placeholder="请输入合同编号" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="买方单位名称" prop="buyerCompany">
          <el-input v-model="form.buyerCompany" placeholder="请输入合同名称" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="合同名称" prop="contractName">
          <el-input v-model="form.contractName" placeholder="请输入合同名称" />
        </el-form-item>
      </el-col>
    </el-row>
    
    <!-- 第二行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="归属项目" prop="projectId">
          <el-select v-model="form.projectId" placeholder="请选择项目" @change="handleProjectChange">
            <el-option
              v-for="project in ProjectOptions"
              :key="project.id"
              :label="project.projectName"
              :value="project.id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="签署状态" prop="signingStatus">
          <el-input v-model="form.signingStatus" placeholder="请输入签署状态" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="买方联系人" prop="buyerContact">
          <el-input v-model="form.buyerContact" placeholder="请输入买方联系人" />
        </el-form-item>
      </el-col>
    </el-row>
    
    <!-- 第三行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="签订日期" prop="signingDate">
          <el-date-picker clearable
            v-model="form.signingDate"
            type="date"
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="请选择签订日期">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="合同性质" prop="contractNature">
          <el-input v-model="form.contractNature" placeholder="请输入合同性质" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="联系电话" prop="contactPhone">
          <el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
        </el-form-item>
      </el-col>
    </el-row>
    
    <!-- 第四行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="邮箱" prop="email">
          <el-input v-model="form.email" placeholder="请输入邮箱" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="合同草案" prop="contractDraft">
          <file-upload v-model="form.contractDraft"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="合同附件" prop="contractAttachment">
          <file-upload v-model="form.contractAttachment"/>
        </el-form-item>
      </el-col>
    </el-row>
    
    <!-- 第五行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="交货时间" prop="deliveryTime">
          <el-date-picker clearable
            v-model="form.deliveryTime"
            type="datetime"
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="请选择交货时间">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="交货地点" prop="deliveryLocation">
          <el-input v-model="form.deliveryLocation" placeholder="请输入交货地点" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="交货条件" prop="deliveryTerms">
          <el-input v-model="form.deliveryTerms" placeholder="请输入交货条件" />
        </el-form-item>
      </el-col>
    </el-row>
    
    <!-- 第六行 -->
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="合同保函" prop="contractDraft">
          <file-upload v-model="form.contractDraft"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="保证金额" prop="email">
          <el-input v-model="form.email" placeholder="请输入保证金额" />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="保质期至" prop="warrantyExpiry">
          <el-date-picker clearable
            v-model="form.warrantyExpiry"
            type="datetime"
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="请选择保质期至">
          </el-date-picker>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
  <template #footer>
    <div class="dialog-footer">
      <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </template>
</el-dialog>
     <!-- 新增：合同查看详情对话框 -->
     <el-dialog :title="viewDialog.title" v-model="viewDialog.visible" width="600px"  label-width="20" append-to-body>
  <div class="p-4">
    <el-descriptions title="合同详情" :column="1" border label-width="180">
  <el-descriptions-item label="合同编号">{{ viewForm.contractNumber }}</el-descriptions-item>
  <el-descriptions-item label="合同名称">{{ viewForm.contractName }}</el-descriptions-item>
      <el-descriptions-item label="归属项目">{{ viewForm.projectName }}</el-descriptions-item>
      <el-descriptions-item label="签订日期">{{ parseTime(viewForm.signingDate, '{y}-{m}-{d}') }}</el-descriptions-item>
      <el-descriptions-item label="合同性质">{{ viewForm.contractNature }}</el-descriptions-item>
      <el-descriptions-item label="买方单位名称">{{ viewForm.buyerCompany }}</el-descriptions-item>
      <el-descriptions-item label="联系电话">{{ viewForm.contactPhone }}</el-descriptions-item>
      <el-descriptions-item label="邮箱">{{ viewForm.email }}</el-descriptions-item>
      <el-descriptions-item label="交货时间">{{ parseTime(viewForm.deliveryTime, '{y}-{m}-{d} {h}:{i}') }}</el-descriptions-item>
      <el-descriptions-item label="交货地点">{{ viewForm.deliveryLocation }}</el-descriptions-item>
      <el-descriptions-item label="交货条件">{{ viewForm.deliveryTerms }}</el-descriptions-item>
      <el-descriptions-item label="保质期至">{{ parseTime(viewForm.warrantyExpiry, '{y}-{m}-{d} {h}:{i}') }}</el-descriptions-item>
    </el-descriptions>
    
    <!-- 合同草案和附件 -->
<!--     <el-form label-width="120px">
      <el-form-item label="合同草案">
        <file-upload v-model="viewForm.contractDraft" disabled/>
      </el-form-item>
      <el-form-item label="合同附件">
        <file-upload v-model="viewForm.contractAttachment" disabled/>
      </el-form-item>
    </el-form> -->


  <!--     <div class="mt-4">
          <h4 class="mb-2">合同草案</h4>
          <el-descriptions :column="1" border v-if="viewForm.contractDraft">
            <el-descriptions-item label="文件名称">{{ viewForm.contractDraft.name }}</el-descriptions-item>
            <el-descriptions-item label="操作">
              <el-button type="primary" size="small" icon="Download" @click="downloadFile(viewForm.contractDraft)">下载</el-button>
            </el-descriptions-item>
          </el-descriptions>
          <el-empty v-else description="暂无合同草案" />
        </div>
        
        <div class="mt-4">
          <h4 class="mb-2">合同附件</h4>
          <el-descriptions :column="1" border v-if="viewForm.contractAttachment">
            <el-descriptions-item label="文件名称">{{ viewForm.contractAttachment.name }}</el-descriptions-item>
            <el-descriptions-item label="操作">
              <el-button type="primary" size="small" icon="Download" @click="downloadFile(viewForm.contractAttachment)">下载</el-button>
            </el-descriptions-item>
          </el-descriptions>
          <el-empty v-else description="暂无合同附件" />
        </div> -->
  </div>
  <template #footer>
    <div class="dialog-footer">
      <el-button @click="viewDialog.visible = false">关闭</el-button>
    </div>
  </template>
</el-dialog>
  </div>
</template>

<script setup name="Contract" lang="ts">
import { listContract, getContract, delContract, addContract, updateContract } from '@/api/project/contract';
import { listProjectinfo, getProjectinfo, delProjectinfo, addlProjectinfo, updateProjectinfo } from '@/api/project/projectInfo';
import { ContractVO, ContractQuery, ContractForm } from '@/api/project/contract/types';
import { ProjectinfoVO } from '@/api/project/project/types';
import { getConSupplies } from '@/api/project/conSupplies';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

const suppliesDialogVisible = ref(false)
const currentContract = ref({})
const suppliesList = ref([])


const contractList = ref<ContractVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);

const queryFormRef = ref<ElFormInstance>();
const contractFormRef = ref<ElFormInstance>();

const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});
const ProjectOptions = ref<ProjectinfoVO[]>([]);//树的内容


const initFormData: ContractForm = {
  id: undefined,
  contractNumber: undefined,
  contractName: undefined,
  projectId: undefined,
  projectName: undefined,
  signingStatus: undefined,
  signingDate: undefined,
  contractNature: undefined,
  buyerContact: undefined,
  buyerCompany: undefined,
  contactPhone: undefined,
  email: undefined,
  contractDraft: undefined,
  contractAttachment: undefined,
  deliveryTime: undefined,
  deliveryLocation: undefined,
  deliveryTerms: undefined,
  warrantyExpiry: undefined,
  contractStatus: undefined,
  approverId: undefined,
  approverName: undefined,
  rejectionReason: undefined,
  approvalTime: undefined,
}
const data = reactive<PageData<ContractForm, ContractQuery>>({
  form: {...initFormData},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    contractNumber: undefined,
    contractName: undefined,
    projectId: undefined,
    projectName: undefined,
    signingStatus: undefined,
    signingDate: undefined,
    contractNature: undefined,
    buyerContact: undefined,
    buyerCompany: undefined,
    contactPhone: undefined,
    email: undefined,
    contractDraft: undefined,
    contractAttachment: undefined,
    deliveryTime: undefined,
    deliveryLocation: undefined,
    deliveryTerms: undefined,
    warrantyExpiry: undefined,
    contractStatus: undefined,
    approverId: undefined,
    approverName: undefined,
    rejectionReason: undefined,
    approvalTime: undefined,
    params: {
    }
  },
  rules: {
    id: [
      { required: true, message: "唯一标识不能为空", trigger: "blur" }
    ],
    contractNumber: [
      { required: true, message: "合同编号不能为空", trigger: "blur" }
    ],
    contractName: [
      { required: true, message: "合同名称不能为空", trigger: "blur" }
    ],
    projectId: [
      { required: true, message: "归属项目ID不能为空", trigger: "blur" }
    ],
  }
});

const { queryParams, form, rules } = toRefs(data);



//查看对话框
// 查看详情对话框
const viewDialog = reactive({
  visible: false,
  title: '合同详情'
});
const viewForm: ContractForm = {
  id: undefined,
  contractNumber: undefined,
  contractName: undefined,
  projectId: undefined,
  projectName: undefined,
  signingStatus: undefined,
  signingDate: undefined,
  contractNature: undefined,
  buyerContact: undefined,
  buyerCompany: undefined,
  contactPhone: undefined,
  email: undefined,
  contractDraft: undefined,
  contractAttachment: undefined,
  deliveryTime: undefined,
  deliveryLocation: undefined,
  deliveryTerms: undefined,
  warrantyExpiry: undefined,
  contractStatus: undefined,
  approverId: undefined,
  approverName: undefined,
  rejectionReason: undefined,
  approvalTime: undefined,
}
/** 查看按钮操作 */
const handleView = async (row: ContractVO) => {
  try {
    const res = await getContract(row.id);
    Object.assign(viewForm, res.data);
    viewDialog.visible = true;
  } catch (error) {
    console.error('获取合同详情失败', error);
    proxy.$message.error('获取合同详情失败');
  }
}
/** 查询合同管理列表 */
const getList = async () => {
  loading.value = true;
  const res = await listContract(queryParams.value);
  contractList.value = res.rows;
  total.value = res.total;
  loading.value = false;
}
/** 项目选择变更时，自动填充项目名称 */
const handleProjectChange = (projectId: number | undefined) => {
  if (projectId) {
    const project = ProjectOptions.value.find(item => item.id === projectId);
    if (project) {
      form.value.projectName = project.projectName;
    }
  } else {
    form.value.projectName = undefined;
  }
}
/** 取消按钮 */
const cancel = () => {
  reset();
  dialog.visible = false;
}

/** 表单重置 */
const reset = () => {
  form.value = {...initFormData};
  contractFormRef.value?.resetFields();
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value?.resetFields();
  handleQuery();
}

/** 多选框选中数据 */
const handleSelectionChange = (selection: ContractVO[]) => {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
const handleAdd = async () => {
  reset();
  await getProjectOptions();
  dialog.visible = true;
  dialog.title = "添加合同";
}

/** 修改按钮操作 */
const handleUpdate = async (row?: ContractVO) => {
  reset();
  const _id = row?.id || ids.value[0]
  const res = await getContract(_id);
  Object.assign(form.value, res.data);
  await getProjectOptions();
  // 确保项目名称与项目ID匹配
  handleProjectChange(form.value.projectId);
  dialog.visible = true;
  dialog.title = "修改合同";
}

/** 提交按钮 */
const submitForm = () => {
  contractFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id) {
        await updateContract(form.value).finally(() =>  buttonLoading.value = false);
      } else {
        await addContract(form.value).finally(() =>  buttonLoading.value = false);
      }
      proxy?.$modal.msgSuccess("操作成功");
      dialog.visible = false;
      await getList();
    }
  });
}
/** 查询项目列表 */
const getProjectOptions = async () => {
  const res = await listProjectinfo();
  ProjectOptions.value = res.rows;
}




/** 删除按钮操作 */
const handleDelete = async (row?: ContractVO) => {
  const _ids = row?.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除合同管理编号为"' + _ids + '"的数据项？').finally(() => loading.value = false);
  await delContract(_ids);
  proxy?.$modal.msgSuccess("删除成功");
  await getList();
}

/** 导出按钮操作 */
const handleExport = () => {
  proxy?.download('project/contract/export', {
    ...queryParams.value
  }, `contract_${new Date().getTime()}.xlsx`)
}

onMounted(() => {
  getList();
});


//
/** 路由跳转到交付物列表 */
const handleCoSupplies = (row: ContractVO) => {
  proxy?.$router.push({
    name: 'ProjectCoSupplies',
    query: {
      contractId: row.id,
      contractName: row.contractName
    }
  });
}




const openSuppliesDialog = async (row) => {
  currentContract.value = row
  suppliesDialogVisible.value = true
  
  // 加载该合同的交付物列表
  try {
    const res = await getConSupplies(row.id)
    suppliesList.value = res.data
  } catch (error) {
    console.error('加载交付物失败:', error)
    proxy.$message.error('加载交付物失败')
  }
}
</script>
